package com.itany.corejava.code07_面向对象.租车系统;

/**
 * @author 石小俊
 * 2024年07月16日 14:43
 */
public class Bus extends MotorVehicle {

    // 客车类有一个属性:seatCount(座位数)
    private int seatCount;

    public Bus(String no, String brand, int seatCount) {
        super(no, brand);
        this.seatCount = seatCount;
    }

    public Bus() {
    }

    public int getSeatCount() {
        return seatCount;
    }

    public void setSeatCount(int seatCount) {
        this.seatCount = seatCount;
    }

    /**
     * 实现计算租金的方法
     * @param day
     * @return
     */
    @Override
    public double rent(int day) {
        double sum = 0;
        if (seatCount <= 30) {
            sum = MotorVehicleConstant.SMALL_BUS_PRICE * day;
        } else {
            sum = MotorVehicleConstant.BIG_BUS_PRICE * day;
        }
        return sum;
    }
}
